/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package callProcs;

import bufete.BufeteView;
import java.math.BigInteger;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author JoseManuel
 */
public class ProcsJMOC {
    
    java.sql.Connection  con = null;
    public void updtAsesordeAlumno(int carne, int idasesor) throws SQLException{
        try {
            con = DriverManager.getConnection("jdbc:mysql://localhost/bufete","root","1234");
           String bandera=null;
           // if (estado) bandera = "true";
            //if (!estado) bandera = "false";
              //java.sql.CallableStatement cs = con.prepareCall("{call Actualiza_estudiante("+carne+"'"+nombre+"','"+apellido+"','"+fecha+"',"+bandera+",'"+reg+"',"+orden+","+dpi+","+idasesor+""+iddir+")}");
            java.sql.CallableStatement cs = con.prepareCall("{call Actualiza_asesor_estudiante("+String.valueOf(carne)+","+String.valueOf(idasesor)+")}");
           java.sql.Statement stmt  = con.createStatement();
            java.sql.ResultSet rs = cs.executeQuery();
            
        } catch (SQLException ex) {
            Logger.getLogger(BufeteView.class.getName()).log(Level.SEVERE, null, ex);
        }
     } 
    
    
    
    public java.sql.ResultSet busca_alumnos_ases(String idasesor) throws SQLException{
       
        java.sql.ResultSet rs = null ;
        try {
            con = DriverManager.getConnection("jdbc:mysql://localhost/bufete","root","1234");
           
       
            Statement cs = con.createStatement();
            rs = cs.executeQuery("SELECT e.NoCarne, e.Nombre_estudiante,e.Apellido_estudiante"
                    + " FROM Asesor a inner join Estudiante e on a.idAsesor = e.Asesor_idAsesor where  a.idAsesor = "+idasesor);
            
        } catch (SQLException ex) {
            Logger.getLogger(BufeteView.class.getName()).log(Level.SEVERE, null, ex);
        }
         return rs;
     } 
    
}
